package lodsve.test.mongodb.repository;

import lodsve.mongodb.repository.LodsveMongoRepository;
import lodsve.test.mongodb.domain.Demo;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;

/**
 * .
 *
 * @author sunhao(sunhao.java @ gmail.com)
 * @version 1.0 2017/12/7 16:01
 */
@Repository
public class DemoRepository extends LodsveMongoRepository<Demo, Long> {
    public Demo findById(Long id) {
        Query query = Query.query(Criteria.where("id").is(id));
        return mongoOperations.findOne(query, Demo.class);
    }
}
